package cashin

class Item {
    String name
    String description
    Integer initialStock
    Integer minStock
    BigDecimal sellingPrice
    BigDecimal vat
    BigDecimal getUnitPrice() {
        sellingPrice / (1+vat/100)
    }
    BigDecimal providerPrice
    BigDecimal getMargin() {
        unitPrice/providerPrice-1
    }

    static belongsTo = [Family,Provider]

    static constraints = {
    }

    static transients = ['unitPrice','margin']
}
